<?php
/**
 *  WB_CacheableObjectClass class unit tests
 *
 *  @author Jean-Lou Dupont
 *  @version @@package-version@@
 */

require_once 'PHPUnit/Framework.php';
require_once 'web-bloks/CacheableObjectClass/CacheableObjectClass.php';

class UnitTest extends PHPUnit_Framework_TestCase
{
	var $obj = null;
		
    protected function setUp()
    {
		$this->obj = new WB_CacheableObjectClass();
    }
 	protected function tearDown()
	{
		unset( $this->obj );
	}
    public function testSimple()
    {
		$this->assertEquals(true, is_object( $this->obj ) );
    }
	/**
	 * setDisposable defaults to 'true'
	 * 
	 */
    public function testGetSet1()
    {
    	$this->obj->setDisposable();
		$result = $this->obj->getDisposable();
		
		$this->assertEquals(true, $result );
    }
	/**
	 * setDisposable 
	 * 
	 */
    public function testGetSet2()
    {
    	$this->obj->setDisposable( false );
		$result = $this->obj->getDisposable();
		
		$this->assertEquals(false, $result );
    }
	/**
	 * modified field test
	 * Defaults to current timestamp
	 * 
	 */
    public function testModifiedField1()
    {
    	$this->obj->setModified();
		$result = $this->obj->getModified();
		
		$timestamp = strtotime( $result );
		$datetime = date( 'Y-m-d H:i:s' , $timestamp );
		
		#echo "datetime: ${datetime}\n";
		
		$this->assertNotEquals(false, $datetime );
    }

	/**
	 * expire field test
	 * Defaults to private defaultExpire
	 * 
	 */
    public function testExpireField1()
    {
    	$this->obj->setExpire();
		$result = $this->obj->getExpire();
		
		$timestamp = strtotime( $result );
		$datetime = date( 'Y-m-d H:i:s' , $timestamp );
		
		#echo "datetime: ${datetime}\n";
		
		$this->assertNotEquals(false, $datetime );
    }

}